<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script>
        var arr = [2,6,1,7,4];
        var sum = 0;
        var average = 0;
        for (var i = 0;i< arr.length;i++){
            sum += arr[i];
        }
        average = sum/arr.length;
        console.log(sum,average);//想到输出多个变量 用逗号分隔即可
    </script>
</head>
<body>

</body>
</html>